-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: catch unhandled error when adding or refreshing oauth apps #35089
Conversation
🦋 Changeset detectedLatest commit: 7aa49c3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 35 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #35089 +/- ##
========================================
Coverage 59.22% 59.22%
========================================
Files 2824 2824
Lines 68071 68069 -2
Branches 15153 15151 -2
========================================
- Hits 40315 40314 -1
Misses 24924 24924
+ Partials 2832 2831 -1
Flags with carried forward coverage won't be shown. Click here to find out more. |
Looks like this PR is ready to merge! 🎉 |
Wonder if this is more of a chore. But if you think it's a fix please add a changeset |
Will do. Grazie mille |
Proposed changes (including videos or screenshots)
When adding a new OAuth app or refreshing OAuth apps, sometimes we get caught in an unhandled promise rejection that ends up crashing the server. The error seems to happen because of some sort of race condition - sometimes the application tries to fetch an ID from the MongoDB, but it's not there yet and it will throw the unhandled promise.
I've noticed that even though it crashes the server, the OAuth app is still added to the database and refreshing OAuth apps also work just fine. This PR adds
try/catch
to prevent the server from crashing when that happens.Issue(s)
SB-762
Steps to test or reproduce
Run the latest version of RocketChat and try to add an OAuth app or refresh OAuth apps.
Further comments
N/A